home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscTableScroll / MiscBorderCell.M < prev    next >
Encoding:
Text File  |  1996-02-11  |  3.6 KB  |  124 lines

  1. //=============================================================================
  2. //
  3. //        Copyright (C) 1995 by Paul S. McCarthy and Eric Sunshine.
  4. //                Written by Paul S. McCarthy and Eric Sunshine.
  5. //                            All Rights Reserved.
  6. //
  7. //        This notice may not be removed from this source code.
  8. //
  9. //        This object is included in the MiscKit by permission from the authors
  10. //        and its use is governed by the MiscKit license, found in the file
  11. //        "License.rtf" in the MiscKit distribution.    Please refer to that file
  12. //        for a list of all applicable permissions and restrictions.
  13. //        
  14. //=============================================================================
  15. //-----------------------------------------------------------------------------
  16. // MiscBorderCell.M
  17. //
  18. //        Cell class used by MiscBorderView to manage column headings and row 
  19. //        labels for MiscTableScroll.     
  20. //
  21. //-----------------------------------------------------------------------------
  22. //-----------------------------------------------------------------------------
  23. // $Id: MiscBorderCell.M,v 1.1 95/09/27 12:21:21 zarnuk Exp $
  24. // $Log:        MiscBorderCell.M,v $
  25. //    Revision 1.1  95/09/27    12:21:21  zarnuk
  26. //    Initial revision
  27. //    
  28. //-----------------------------------------------------------------------------
  29. #import "MiscBorderCell.h"
  30.  
  31. extern "Objective-C" {
  32. #import <appkit/Font.h>
  33. #import <appkit/Text.h>
  34. #import <dpsclient/wraps.h>
  35. }
  36.  
  37. @implementation MiscBorderCell
  38.  
  39. - initTextCell: (char const*) s
  40.     {
  41.     [super initTextCell:s];
  42.     [self setBordered:NO];
  43.     [self setWrap:NO];
  44.     [self setAlignment: NX_CENTERED];
  45.     [self setFont: [Font boldSystemFontOfSize:12.0 matrix:NX_FLIPPEDMATRIX]];
  46.     return self;
  47.     }
  48.  
  49.  
  50. - (float) backgroundGray
  51.     {
  52.     return cFlags1.state ? (1.0/6.0) : NX_DKGRAY;
  53.     }
  54.  
  55.  
  56. - setTextAttributes:textObject
  57.     {
  58.     [super setTextAttributes:textObject];
  59.     [textObject setTextGray:NX_WHITE];
  60.     [textObject setBackgroundGray: [self backgroundGray]];
  61.     return textObject;
  62.     }
  63.  
  64.  
  65. - drawInside:(NXRect const*)cellFrame inView:controlView
  66.     {
  67.     NXRect r;
  68.     PSsetgray( [self backgroundGray] );
  69.     NXSetRect( &r, NX_X(cellFrame)+2, NX_Y(cellFrame)+2,
  70.                    NX_WIDTH(cellFrame) - 3, NX_HEIGHT(cellFrame) - 3 );
  71.     NXRectFill( &r );
  72.     [super drawInside:&r inView:controlView];
  73.     return self;
  74.     }
  75.  
  76.  
  77. - drawSelf:(NXRect const*)cellFrame inView:aView
  78.     {
  79.     NXRect r[2];
  80.  
  81.     PSsetgray( NX_LTGRAY );
  82.     NXSetRect( &(r[0]), NX_X(cellFrame), NX_Y(cellFrame),
  83.                         1, NX_HEIGHT(cellFrame) );
  84.     NXSetRect( &(r[1]), NX_X(cellFrame) + 1, NX_Y(cellFrame),
  85.                         NX_WIDTH(cellFrame) - 1, 1 );
  86.     NXRectFillList( r, 2 );
  87.     
  88.     PSsetgray( NX_WHITE );
  89.     NXSetRect( &(r[0]), NX_X(cellFrame) + 1, NX_Y(cellFrame) + 1,
  90.                         1, NX_HEIGHT(cellFrame) - 2 );
  91.     NXSetRect( &(r[1]), NX_X(cellFrame) + 2, NX_Y(cellFrame) + 1,
  92.                         NX_WIDTH(cellFrame) - 3, 1 );
  93.     NXRectFillList( r, 2 );
  94.  
  95.     PSsetgray( NX_BLACK );
  96.     NXSetRect( &(r[0]), NX_MAXX(cellFrame) - 1, NX_Y(cellFrame) + 2,
  97.                         1, NX_HEIGHT(cellFrame) - 2 );
  98.     NXSetRect( &(r[1]), NX_X(cellFrame) + 2, NX_MAXY(cellFrame) - 1,
  99.                         NX_WIDTH(cellFrame) - 3, 1 );
  100.     NXRectFillList( r, 2 );
  101.  
  102.     PSsetgray( NX_DKGRAY );
  103.     NXSetRect( &(r[0]), NX_X(cellFrame)+1, NX_MAXY(cellFrame) - 1, 1, 1 );
  104.     NXSetRect( &(r[1]), NX_MAXX(cellFrame) - 1, NX_Y(cellFrame) + 1, 1, 1 );
  105.     NXRectFillList( r, 2 );
  106.  
  107.     return [self drawInside:cellFrame inView:aView];
  108.     }
  109.  
  110.  
  111. // - highlight:(NXRect const*)cellFrame inView:controlView lit:(BOOL)flag
  112. //       {
  113. // //      if (cFlags1.highlighted != flag)
  114. // //    {
  115. // //    cFlags1.highlighted = flag;
  116. // //    [self drawInside:cellFrame inView:controlView];
  117. // //    }
  118. //       cFlags1.highlighted = flag;
  119. //       [self drawInside:cellFrame inView:controlView];
  120. //       return self;
  121. //       }
  122.  
  123. @end
  124.